package com.example.common;

import java.util.Collection;
import java.util.StringJoiner;

/**
 * 查询输出
 *
 * @author Chris
 * @since 2022/11/30 16:23:13
 */
public class PageVo<T> {
    /**
     * 查询记录列表
     */
    private final Collection<T> list;
    /**
     * 查询记录数
     */
    private final Long total;
    /**
     * 页索引
     */
    private final Long page;
    /**
     * 页大小
     */
    private final Long size;


    public PageVo(Collection<T> list, Long total, Long page, Long size) {
        this.list = list;
        this.total = total;
        this.page = page;
        this.size = size;
    }

    public Collection<T> getList() {
        return list;
    }

    public Long getTotal() {
        return total;
    }

    public Long getPage() {
        return page;
    }

    public Long getSize() {
        return size;
    }

    @Override
    public String toString() {
        return new StringJoiner(", ", PageVo.class.getSimpleName() + "[", "]")
                .add("list=" + list)
                .add("count=" + total)
                .toString();
    }

}
